<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
class PHPExcel_Shared_TimeZone
{
    protected static $timezone = "UTC";
    public static function _validateTimeZone($timezone)
    {
        if(in_array($timezone, DateTimeZone::listIdentifiers())) {
            return true;
        }
        return false;
    }
    public static function setTimeZone($timezone)
    {
        if(self::_validateTimezone($timezone)) {
            self::$timezone = $timezone;
            return true;
        }
        return false;
    }
    public static function getTimeZone()
    {
        return self::$timezone;
    }
    private static function getTimezoneTransitions($objTimezone, $timestamp)
    {
        $allTransitions = $objTimezone->getTransitions();
        $transitions = [];
        foreach ($allTransitions as $key => $transition) {
            if($timestamp < $transition["ts"]) {
                $transitions[] = 0 < $key ? $allTransitions[$key - 1] : $transition;
                return $transitions;
            }
            if(empty($transitions)) {
                $transitions[] = end($allTransitions);
            }
        }
    }
    public static function getTimeZoneAdjustment($timezone, $timestamp)
    {
        if($timezone !== NULL) {
            if(!self::_validateTimezone($timezone)) {
                throw new PHPExcel_Exception("Invalid timezone " . $timezone);
            }
        } else {
            $timezone = self::$timezone;
        }
        if($timezone == "UST") {
            return 0;
        }
        $objTimezone = new DateTimeZone($timezone);
        if(0 <= version_compare(PHP_VERSION, "5.3.0")) {
            $transitions = $objTimezone->getTransitions($timestamp, $timestamp);
        } else {
            $transitions = self::getTimezoneTransitions($objTimezone, $timestamp);
        }
        return 0 < count($transitions) ? $transitions[0]["offset"] : 0;
    }
}

?>